﻿Imports System.Collections.Generic
Imports System.Configuration
Imports System.ServiceModel
Imports System.ServiceModel.Channels
Imports IETracker.Business.Entities
Imports System.Diagnostics


Imports IETracker.UI.Process.IETrackerServiceReference
Imports System.Collections.ObjectModel
Imports IETracker.WCFServices

Public Class SubmitterProcess
    Implements ISubmitterProcess

    Public Function GetTransactionList(_transactionType As String) As List(Of TransactionList) Implements ISubmitterProcess.GetTransactionLists
        Try
            Dim cc As New IETrackerServiceClient
            Dim x As List(Of TransactionList) = Nothing
            Return x 'cc .retTransactionList(_transactionType)
        Catch ex As Exception
            Throw New FaultException(Of ProcessExecutionFault)(New ProcessExecutionFault(), ex.Message)
        End Try
    End Function

    Public Function ReadAllTransaction() As List(Of Transaction) Implements ISubmitterProcess.ReadAllTransaction
        Try
            Dim cc As New IETrackerServiceClient
            Return cc.ReadAllTransaction.ToList
        Catch ex As Exception
            Throw New FaultException(Of ProcessExecutionFault)(New ProcessExecutionFault(), ex.Message)
        End Try
    End Function

    Public Function CreateTransaction(_transactionList As TransactionList) As TransactionList Implements ISubmitterProcess.CreateTransaction
        Try
            Dim cc As New IETrackerServiceClient
            Return cc.CreateTransaction(_transactionList)
        Catch ex As Exception
            Throw New FaultException(Of ProcessExecutionFault)(New ProcessExecutionFault(), ex.Message)
        End Try
    End Function

    Public Function GetExpenseList(Optional endDate As Date = #12:00:00 AM#, Optional returnNumberOfTransactions As Integer = 0) As List(Of TransactionList) Implements ISubmitterProcess.GetExpenseList
        Try
            Dim cc As New IETrackerServiceClient
            Return cc.GetExpenseList(endDate, returnNumberOfTransactions).ToList
        Catch ex As Exception
            Throw New FaultException(Of ProcessExecutionFault)(New ProcessExecutionFault(), ex.Message)
        End Try
    End Function
End Class
